﻿@{
    Layout = "~/Views/Shared/_FormWhite.cshtml";
}

<div class="wrapper animated fadeInRight">
    <form id="form" class="form-horizontal m">
        <div class="form-group">
            <label class="col-sm-2 control-label ">系统编号<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="xTBH" col="XTBH" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">系统生产厂家<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="xTSCCJ" col="XTSCCJ" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">系统序列号<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="yDJXLH" col="YDJXLH" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">烟度计厂家<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="yDJCJ" col="YDJCJ" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">烟度计型号<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="yDJXH" col="YDJXH" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">烟度计编号<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="yDJBH" col="YDJBH" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">烟度计检定日期<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="yDJJDRQ" col="YDJJDRQ" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">转速仪厂家<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="zSYCJ" col="ZSYCJ" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">转速仪型号<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="zSYXH" col="ZSYXH" type="text" class="form-control" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label ">转速仪编号<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="zSYBH" col="ZSYBH" type="text" class="form-control" />
            </div>
            <label class="col-sm-2 control-label ">转速仪检定日期<font class="red"> *</font></label>
            <div class="col-sm-4">
                <input id="zSYJDRQ" col="ZSYJDRQ" type="text" class="form-control" />
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    var id = ys.request("id");
    $(function () {
        getForm();

        $('#form').validate({
            rules: {
                xTBH: { required: true }
            }
        });
    });

    function getForm() {
        if (id > 0) {
            ys.ajax({
                url: '@Url.Content("~/YiDongYuan/DetectionDevice/GetFormJson")' + '?id=' + id,
                type: 'get',
                success: function (obj) {
                    if (obj.Tag == 1) {
                        $('#form').setWebControls(obj.Data);
                    }
                }
            });
        }
        else {
            var defaultData = {};
            $('#form').setWebControls(defaultData);
        }
    }

    function saveForm(index) {
        if ($('#form').validate().form()) {
            var postData = $('#form').getWebControls({ Id: id });
            ys.ajax({
                url: '@Url.Content("~/YiDongYuan/DetectionDevice/SaveFormJson")',
                type: 'post',
                data: postData,
                success: function (obj) {
                    if (obj.Tag == 1) {
                        ys.msgSuccess(obj.Message);
                        parent.searchGrid();
                        parent.layer.close(index);
                    }
                    else {
                        ys.msgError(obj.Message);
                    }
                }
            });
        }
    }
</script>

